Skip to content

Fix to avoid premature exit#1

Open
mortan wants to merge 1 commit into
arturmkrtchyan:masterfrom
mortan:master
Open

Fix to avoid premature exit#1
mortan wants to merge 1 commit into
arturmkrtchyan:masterfrom
mortan:master

Conversation

@mortan

@mortan mortan commented Apr 10, 2015

Copy link
Copy Markdown

Hi!

You should sync with the destination to avoid wrong measurement results.

No sync:
./fcopy /tmp/rbigfile.dat /tmp/wbigfile2.dat 2 0.00s user 0.24s system 99% cpu 0.242 total

0.242 seconds for a 1 GB file on a ~180MB/s hard disk...

grep Dirty /proc/meminfo
Dirty: 1048476 kB

There we go, dirty memory that isn't flushed yet to the disk!

After adding the fdatasync call:
./fcopy /tmp/rbigfile.dat /tmp/wbigfile2.dat 2 0.00s user 0.32s system 4% cpu 6.461 total

Regards!

@arturmkrtchyan

Copy link
Copy Markdown
Owner

Hi

Thanks for the pull request!

This is not about how fast is disc access etc... and I'm not flushing to disk in any example. So I guess comparison is fare enough. What do you think ?

Thanks,
Artur

@mortan

mortan commented Apr 10, 2015

Copy link
Copy Markdown
Author

Hi!

If you don't sync after the (zero copy) sendfile call the disk write gets queued (on my linux system) and you can't compare the execution time!

Regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants